package com.zbf.role;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zbf.dao.RoleDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 作者: LCG
 * 日期: 2020/6/9 20:58
 * 描述:
 */
@Component
public class RoleService {

    @Autowired
    private RoleDao roleDao;


    /**
     * 角色列表分页
     * @param map
     * @return
     */
    public PageInfo<Map<String,Object>> getPageRole(Map<String,Object> map){
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),Integer.valueOf(map.get("pageSize").toString()));
        List<Map<String, Object>> roleList = roleDao.getRoleList(map);
        PageInfo<Map<String,Object>> pageInfo=new PageInfo<>(roleList);
        return pageInfo;
    }


    public List<Map<String,Object>> getRoleListByName(String roleName){
       return roleDao.getRoleListByName(roleName);
    }
}
